package oschina.by.isrefluxer.com.weatherapplication;

import android.content.Context;
import android.util.Log;

/**
 * 项目名称：WeatherApplication
 * 类描述：
 * 创建人：Administrator
 * 创建时间：2016/10/18 15:49
 * 修改人：Administrator
 * 修改时间：2016/10/18 15:49
 * 修改备注：
 */
public class Weather {
    private String current_condition;
    private int  current_condition_code;
    private String current_temperature;
    private String max_temperature;
    private String min_temperature;

    private String city;

    public String getMin_temperature() {
        return min_temperature;
    }

    public void setMin_temperature(String min_temperature) {
        this.min_temperature = min_temperature;
    }

    public String getMax_temperature() {
        return max_temperature;
    }

    public void setMax_temperature(String max_temperature) {
        this.max_temperature = max_temperature;
    }

    public String getCurrent_condition() {
        return current_condition;
    }

    public void setCurrent_condition(String current_condition) {
        this.current_condition = current_condition;
    }

    public int getCurrent_condition_code() {
        return current_condition_code;
    }

    public void setCurrent_condition_code(int current_condition_code) {
        this.current_condition_code = current_condition_code;
    }

    public String getCurrent_temperature() {
        return current_temperature;
    }

    public void setCurrent_temperature(String current_temperature) {
        this.current_temperature = current_temperature;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public int current_conditionRes(Context context) {

        String name ="";
        switch (getCurrent_condition_code()){
            case 0:
                name = "weather_"+0;
                break;
            case 100:
                name = "weather_"+1;
                break;
            case 101:
                name = "weather_"+2;
                break;
            case 200:
            case 201:
            case 202:
            case 203:
            case 204:
            case 205:
            case 206:
            case 207:
            case 208:
            case 209:
            case 210:
            case 211:
            case 212:
            case 214:
            case 215:
                name = "weather_"+3;
                break;
            case 300:
            case 301:
            case 302:
            case 303:
            case 304:
            case 305:
            case 306:
            case 307:
            case 308:
            case 309:
                name = "weather_"+4;
                break;
            case 400:
                name = "weather_"+5;
                break;
            case 500:
            case 501:
            case 502:
            case 503:
            case 504:
                name = "weather_"+6;
                break;
            case 213:
                name = "weather_"+7;
                break;
            default:
                break;

        }
        Log.e("name=",name);
        Log.e("getIdentifier=",context.getResources().getIdentifier(name,"drawable",context.getPackageName())+"");
      return   context.getResources().getIdentifier(name,"drawable",context.getPackageName());
    }
}
